package com.roadmap.common;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import com.roadmap.entities.Achievement;
import com.roadmap.entities.Article;
import com.roadmap.entities.Aspirant;
import com.roadmap.entities.Assessment;
import com.roadmap.entities.Career;
import com.roadmap.entities.Category;
import com.roadmap.entities.Comment;
import com.roadmap.entities.Contact;
import com.roadmap.entities.Dialog;
import com.roadmap.entities.Execution;
import com.roadmap.entities.Friendship;
import com.roadmap.entities.LifeGoal;
import com.roadmap.entities.LifeMap;
import com.roadmap.entities.LifePlan;
import com.roadmap.entities.LifeTask;
import com.roadmap.entities.LimitedAccess;
import com.roadmap.entities.Message;
import com.roadmap.entities.Notice;
import com.roadmap.entities.Registration;
import com.roadmap.entities.Request;
import com.roadmap.entities.Student;
import com.roadmap.entities.Visitor;

public final class RdcConst {

	private RdcConst() {
	}

	public final static String ACHIEVE = Achievement.class.getSimpleName();
	public final static String BLOG = Article.class.getSimpleName();
	public final static String CAREER = Career.class.getSimpleName();
	public final static String COMMENT = Comment.class.getSimpleName();
	public final static String CONTACT = Contact.class.getSimpleName();
	public final static String DIALOG = Dialog.class.getSimpleName();
	public final static String DREAM = LifeMap.class.getSimpleName();
	public final static String EXEC = Execution.class.getSimpleName();
	public final static String FRIEND = Friendship.class.getSimpleName();
	public final static String GOAL = LifeGoal.class.getSimpleName();
	public final static String GROUP = Category.class.getSimpleName();
	public final static String LIMITED = LimitedAccess.class.getSimpleName();
	public final static String MESSAGE = Message.class.getSimpleName();
	public final static String NOTE = Notice.class.getSimpleName();
	public final static String PLAN = LifePlan.class.getSimpleName();
	public final static String REG = Registration.class.getSimpleName();
	public final static String REQUEST = Request.class.getSimpleName();
	public final static String SCORE = Assessment.class.getSimpleName();
	public final static String STUDENT = Student.class.getSimpleName();
	public final static String TASK = LifeTask.class.getSimpleName();
	public final static String USER = Aspirant.class.getSimpleName();
	public final static String VISIT = Visitor.class.getSimpleName();

	// 映射manager类型和manager的类名
	private final static Map<String, String> managerNameClassMap = new HashMap<String, String>();

	// 映射实体短名和实体类型
	private final static Map<String, Class> entityNameClassMap = new HashMap<String, Class>();

	// 可以被通用类处理的实体短名
	private final static Set<String> commonEntityNameSet = new HashSet<String>();

	static {
		managerNameClassMap.put(ACHIEVE, "com.roadmap.biz.common.CommonManager");
		managerNameClassMap.put(BLOG, "com.roadmap.biz.life.blog.ArticleManager");
		managerNameClassMap.put(CAREER, "com.roadmap.biz.common.CommonManager");
		managerNameClassMap.put(COMMENT, "com.roadmap.biz.message.CommentManager");
		managerNameClassMap.put(CONTACT, "com.roadmap.biz.common.CommonManager");
		managerNameClassMap.put(DREAM, "com.roadmap.biz.common.CommonManager");
		managerNameClassMap.put(EXEC, "com.roadmap.biz.life.task.ExecutionManager");
		managerNameClassMap.put(FRIEND, "com.roadmap.biz.sns.FriendshipManager");
		managerNameClassMap.put(GOAL, "com.roadmap.biz.life.goal.GoalManager");
		managerNameClassMap.put(MESSAGE, "com.roadmap.biz.message.MessageManager");
		managerNameClassMap.put(PLAN, "com.roadmap.biz.life.plan.PlanManager");
		managerNameClassMap.put(REQUEST, "com.roadmap.biz.sns.RequestManager");
		managerNameClassMap.put(STUDENT, "com.roadmap.biz.common.CommonManager");
		managerNameClassMap.put(TASK, "com.roadmap.biz.life.task.TaskManager");
		managerNameClassMap.put(USER, "com.roadmap.biz.common.CommonManager");
		managerNameClassMap.put(VISIT, "com.roadmap.biz.sns.VisitorManager");

		entityNameClassMap.put(ACHIEVE, Achievement.class);
		entityNameClassMap.put(BLOG, Article.class);
		entityNameClassMap.put(CAREER, Career.class);
		entityNameClassMap.put(COMMENT, Comment.class);
		entityNameClassMap.put(CONTACT, Contact.class);
		entityNameClassMap.put(DIALOG, Dialog.class);
		entityNameClassMap.put(DREAM, LifeMap.class);
		entityNameClassMap.put(EXEC, Execution.class);
		entityNameClassMap.put(FRIEND, Friendship.class);
		entityNameClassMap.put(GOAL, LifeGoal.class);
		entityNameClassMap.put(GROUP, Category.class);
		entityNameClassMap.put(LIMITED, LimitedAccess.class);
		entityNameClassMap.put(MESSAGE, Message.class);
		entityNameClassMap.put(NOTE, Notice.class);
		entityNameClassMap.put(PLAN, LifePlan.class);
		entityNameClassMap.put(REG, Registration.class);
		entityNameClassMap.put(REQUEST, Request.class);
		entityNameClassMap.put(SCORE, Assessment.class);
		entityNameClassMap.put(STUDENT, Student.class);
		entityNameClassMap.put(TASK, LifeTask.class);
		entityNameClassMap.put(USER, Aspirant.class);
		entityNameClassMap.put(VISIT, Visitor.class);

		commonEntityNameSet.add(ACHIEVE);
		commonEntityNameSet.add(CAREER);
		commonEntityNameSet.add(CONTACT);
		commonEntityNameSet.add(DREAM);
		commonEntityNameSet.add(STUDENT);
		commonEntityNameSet.add(USER);

	}

	public static String getManagerNameClazz(String typeName) {
		return managerNameClassMap.get(typeName);
	}

	public static Class getEntityNameClazz(String typeName) {
		return entityNameClassMap.get(typeName);
	}

	public static Set<String> getCommonEntityNameSet() {
		return commonEntityNameSet;
	}

}
